package 周赛;

public class 找出数组中第一个回文字符串 {
    public String firstPalindrome(String[] words) {
        for (String word : words) {
            if (isHui(word))
                return word;
        }
        return "";
    }
    boolean isHui(String s){
        int i = 0,j = s.length()-1;
        while (i<j){
            if (s.charAt(i)==s.charAt(j)){
                i++;
                j--;
            }
            else
                return false;
        }
        return true;
    }
}
